package what.basic.list;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Jdefaultcomboboxmodel {
	String[] s={"zhuban","yingpan","neicun","dianyuan","jianpan","shubiao","xianshiqi","guangqu"};
	public Jdefaultcomboboxmodel(){
		JFrame f=new JFrame("defaultcomboboxmodel");
		Container cp=f.getContentPane();
		ComboBoxModel cm=new AModel(s);
		JComboBox cmb=new JComboBox(cm);
		cmb.setBorder(BorderFactory.createTitledBorder("diannaopeijian"));
		cp.add(cmb);
		f.pack();
		f.setVisible(true);
		f.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
				System.exit(0);
			}
		});
		
	}
	public static void main(String[] args) {
		new Jdefaultcomboboxmodel();
	}
class AModel extends DefaultComboBoxModel{
	AModel(String[] s){
		for(int i=0;i<s.length;i++)
			addElement(s[i]);
	}
}
}
